<?php
	include 'author.php';

	$user   = $_GET["user"];
	$device = $_GET["device"];
	$token 	= $_GET["token"];
	$time	= date("Y-m-d H:i:s",time());

	//회원이 가입되어 있는지 확인
	$query 	= "SELECT count(*) FROM app_sb_user WHERE user='$user'";
	$result = mysql_query($query) or die(mysql_error());
    if (mysql_result($result, 0) > 0)
	{
		$output = "e";
	}
	else
	{
		$query    = "INSERT INTO app_sb_user (user, device, token, date, state) VALUES ('$user', '$device', '$token', '$time', '1')";
		mysql_query($query, $dbConn) or die(mysql_error());
		$output = "s";
	}
	echo "{\"result\":\"$output\"}";
	mysql_close($dbConn);
?>